﻿using UnityEngine;
using System.Collections;

public class Character : MonoBehaviour {

    public CollisionFloor _collisionFloor;
    public GameObject[] _CollisionObj;

    public GameObject _gunBarrel;
    private float _gunBarrelAngle = 0.0f;
    public Animator _animator;

    public enum AnimationState
    {
        idle = 0,
        run = 1,
    }

    public void SetAnimState(AnimationState state)
    {
        _animator.SetInteger("aniState", (int)state);
    }

	void Awake() 
    {
        _collisionFloor = new CollisionFloor(gameObject, _CollisionObj);
	}

    public void UpdownGunBarrel(int upDown, float fDT)
    {
        _gunBarrelAngle = _gunBarrelAngle + fDT * 100 * (float)upDown;

        _gunBarrelAngle = _gunBarrelAngle > 90 ? 90 : _gunBarrelAngle;
        _gunBarrelAngle = _gunBarrelAngle < 0 ? 0 : _gunBarrelAngle;

        _gunBarrel.transform.localRotation.SetEulerRotation(new Vector3(_gunBarrel.transform.localEulerAngles.x, _gunBarrelAngle, _gunBarrel.transform.localEulerAngles.z));
    }

}
